﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdGiDefaultContext : OdGiContext
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdGiDefaultContext(IntPtr cPtr, bool cMemoryOwn) : base(GlobalsPINVOKE.OdGiDefaultContext_SWIGUpcast(cPtr), cMemoryOwn)
		{
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdGiDefaultContext obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdGiDefaultContext()
		{
			this.Dispose();
		}

		public override void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdGiDefaultContext(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
			base.Dispose();
		}

		public new static OdGiDefaultContext cast(OdRxObject pObj)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdGiDefaultContext_cast(OdRxObject.getCPtr(pObj));
			OdGiDefaultContext result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdGiDefaultContext)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdGiDefaultContext)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdGiDefaultContext)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdRxClass desc()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdGiDefaultContext_desc(), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxClass isA()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdGiDefaultContext_isA(this.swigCPtr), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxObject queryX(OdRxClass protocolClass)
		{
			OdRxObject result = Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdGiDefaultContext_queryX(this.swigCPtr, OdRxClass.getCPtr(protocolClass)), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdGiDefaultContext createObject()
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdGiDefaultContext_createObject();
			OdGiDefaultContext result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdGiDefaultContext)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdGiDefaultContext)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdGiDefaultContext)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual void getDefaultTextStyle(OdGiTextStyle textStyle)
		{
			GlobalsPINVOKE.OdGiDefaultContext_getDefaultTextStyle(this.swigCPtr, OdGiTextStyle.getCPtr(textStyle));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public new virtual void drawText(OdGiCommonDraw pDraw, OdGePoint3d position, string msg, OdGiTextStyle pTextStyle, uint flags)
		{
			GlobalsPINVOKE.OdGiDefaultContext_drawText__SWIG_0(this.swigCPtr, OdGiCommonDraw.getCPtr(pDraw), OdGePoint3d.getCPtr(position), msg, OdGiTextStyle.getCPtr(pTextStyle), flags);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public new virtual void drawText(OdGiCommonDraw pDraw, OdGePoint3d position, string msg, OdGiTextStyle pTextStyle)
		{
			GlobalsPINVOKE.OdGiDefaultContext_drawText__SWIG_1(this.swigCPtr, OdGiCommonDraw.getCPtr(pDraw), OdGePoint3d.getCPtr(position), msg, OdGiTextStyle.getCPtr(pTextStyle));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public new virtual void drawText(OdGiCommonDraw pDraw, OdGePoint3d position, double height, double width, double oblique, string msg)
		{
			GlobalsPINVOKE.OdGiDefaultContext_drawText__SWIG_2(this.swigCPtr, OdGiCommonDraw.getCPtr(pDraw), OdGePoint3d.getCPtr(position), height, width, oblique, msg);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public new virtual void drawText(OdGiConveyorGeometry pDest, OdGePoint3d position, OdGeVector3d direction, OdGeVector3d upVector, string msg, bool raw, OdGiTextStyle pTextStyle, OdGeVector3d pExtrusion)
		{
			GlobalsPINVOKE.OdGiDefaultContext_drawText__SWIG_3(this.swigCPtr, pDest.GetCPtr(), OdGePoint3d.getCPtr(position), OdGeVector3d.getCPtr(direction), OdGeVector3d.getCPtr(upVector), msg, raw, OdGiTextStyle.getCPtr(pTextStyle), OdGeVector3d.getCPtr(pExtrusion));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public new virtual void drawShape(OdGiCommonDraw pDraw, OdGePoint3d position, int shapeNumber, OdGiTextStyle pTextStyle)
		{
			GlobalsPINVOKE.OdGiDefaultContext_drawShape__SWIG_0(this.swigCPtr, OdGiCommonDraw.getCPtr(pDraw), OdGePoint3d.getCPtr(position), shapeNumber, OdGiTextStyle.getCPtr(pTextStyle));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public new virtual void drawShape(OdGiConveyorGeometry pDest, OdGePoint3d position, OdGeVector3d direction, OdGeVector3d upVector, int shapeNumber, OdGiTextStyle pTextStyle, OdGeVector3d pExtrusion)
		{
			GlobalsPINVOKE.OdGiDefaultContext_drawShape__SWIG_1(this.swigCPtr, pDest.GetCPtr(), OdGePoint3d.getCPtr(position), OdGeVector3d.getCPtr(direction), OdGeVector3d.getCPtr(upVector), shapeNumber, OdGiTextStyle.getCPtr(pTextStyle), OdGeVector3d.getCPtr(pExtrusion));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public new virtual void textExtentsBox(OdGiTextStyle textStyle, string msg, uint flags, OdGePoint3d min, OdGePoint3d max, OdGePoint3d pEndPos)
		{
			GlobalsPINVOKE.OdGiDefaultContext_textExtentsBox__SWIG_0(this.swigCPtr, OdGiTextStyle.getCPtr(textStyle), msg, flags, OdGePoint3d.getCPtr(min), OdGePoint3d.getCPtr(max), OdGePoint3d.getCPtr(pEndPos));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public new virtual void textExtentsBox(OdGiTextStyle textStyle, string msg, uint flags, OdGePoint3d min, OdGePoint3d max)
		{
			GlobalsPINVOKE.OdGiDefaultContext_textExtentsBox__SWIG_1(this.swigCPtr, OdGiTextStyle.getCPtr(textStyle), msg, flags, OdGePoint3d.getCPtr(min), OdGePoint3d.getCPtr(max));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public new virtual void shapeExtentsBox(OdGiTextStyle textStyle, int shapeNumber, OdGePoint3d min, OdGePoint3d max)
		{
			GlobalsPINVOKE.OdGiDefaultContext_shapeExtentsBox(this.swigCPtr, OdGiTextStyle.getCPtr(textStyle), shapeNumber, OdGePoint3d.getCPtr(min), OdGePoint3d.getCPtr(max));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setPlotGeneration(bool plotGeneration)
		{
			GlobalsPINVOKE.OdGiDefaultContext_setPlotGeneration(this.swigCPtr, plotGeneration);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public new virtual uint paletteBackground()
		{
			uint result = GlobalsPINVOKE.OdGiDefaultContext_paletteBackground(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void setPaletteBackground(uint paletteBackground)
		{
			GlobalsPINVOKE.OdGiDefaultContext_setPaletteBackground(this.swigCPtr, paletteBackground);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual bool isZeroTextNormals()
		{
			bool result = GlobalsPINVOKE.OdGiDefaultContext_isZeroTextNormals(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual bool supportVerticalTTFText()
		{
			bool result = GlobalsPINVOKE.OdGiDefaultContext_supportVerticalTTFText(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual bool useGsModel()
		{
			bool result = GlobalsPINVOKE.OdGiDefaultContext_useGsModel(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void enableGsModel(bool enable)
		{
			GlobalsPINVOKE.OdGiDefaultContext_enableGsModel(this.swigCPtr, enable);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public new virtual OdDbStub getStubByID(ulong persistentId)
		{
			IntPtr intPtr = GlobalsPINVOKE.OdGiDefaultContext_getStubByID(this.swigCPtr, persistentId);
			OdDbStub result = (intPtr == IntPtr.Zero) ? null : new OdDbStub(intPtr, false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual ulong getIDByStub(OdDbStub objectId)
		{
			ulong result = GlobalsPINVOKE.OdGiDefaultContext_getIDByStub(this.swigCPtr, OdDbStub.getCPtr(objectId));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxObject getDatabaseByStub(OdDbStub objectId)
		{
			OdRxObject result = Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdGiDefaultContext_getDatabaseByStub(this.swigCPtr, OdDbStub.getCPtr(objectId)), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdDbStub getOwnerIDByStub(OdDbStub objectId)
		{
			IntPtr intPtr = GlobalsPINVOKE.OdGiDefaultContext_getOwnerIDByStub(this.swigCPtr, OdDbStub.getCPtr(objectId));
			OdDbStub result = (intPtr == IntPtr.Zero) ? null : new OdDbStub(intPtr, false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		private object locker = new object();

		private HandleRef swigCPtr;
	}
}
